﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using Visifire.Gauges;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public partial class DataGaugeBase
    {
        public BarIndicator SetBarIndicator(BarIndicator barIndicator)
        {
            barIndicator.BorderBrush = BarBorderBursh==null? null : BarBorderBursh.Brush;
            barIndicator.BorderThickness = BarBorderThickness;
            barIndicator.Background = BarBackground==null? null : BarBackground.Brush;
            barIndicator.LabelBackground = BarLabelBackground==null? null : BarLabelBackground.Brush;
            barIndicator.LabelEnabled = BarLabelEnabled;
            barIndicator.LabelFontColor = BarLabelFontColor==null?null: BarLabelFontColor.Brush;
            barIndicator.LabelFontFamily = BarLabelFontFamily;
            barIndicator.LabelFontWeight = BarLabelFontWeight;
            barIndicator.Placement = BarPlacement;
            barIndicator.ShadowEnabled = BarShadowEnabled;
            barIndicator.ToolTipText = BarToolTipText;


            barIndicator.DistanceFromScale = BarDistanceFromScale;
            barIndicator.StartWidth = BarStartWidth;
            barIndicator.EndWidth = BarEndWidth;

            return barIndicator;
        }
        private BrushEx barBorderBursh;
        private Thickness barBorderThickness;
        private BrushEx barBackground;
        private BrushEx barLabelBackground;
        private bool barLabelEnabled;
        private BrushEx barLabelFontColor;
        private FontFamily barLabelFontFamily;
        private FontWeight barLabelFontWeight;
        private PlacementTypes barPlacement;
        private bool barShadowEnabled;
        private string barToolTipText;


        private double barDistanceFromScale;
        private double? barStartWidth;
        private double? barEndWidth;

        [Category("进度条")]
        [DisplayName("进度条边框颜色")]
        [Description("BarBorderBursh")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarBorderBursh", "进度条颜色")]
        public BrushEx BarBorderBursh
        {
            get
            {
                return barBorderBursh;
            }

            set
            {
                barBorderBursh = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条边框大小")]
        [Description("BarBorderThickness")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarBorderThickness", "进度条边框大小")]
        public Thickness BarBorderThickness
        {
            get
            {
                return barBorderThickness;
            }

            set
            {
                barBorderThickness = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条背景颜色")]
        [Description("BarBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarBackground", "进度条背景颜色")]
        public BrushEx BarBackground
        {
            get
            {
                return barBackground;
            }

            set
            {
                barBackground = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条标签背景颜色")]
        [Description("BarLabelBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarLabelBackground", "进度条标签背景颜色")]
        public BrushEx BarLabelBackground
        {
            get
            {
                return barLabelBackground;
            }

            set
            {
                barLabelBackground = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条标签是否可用")]
        [Description("BarLabelEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarLabelEnabled", "进度条标签是否可用")]
        public bool BarLabelEnabled
        {
            get
            {
                return barLabelEnabled;
            }

            set
            {
                barLabelEnabled = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条标签字体颜色")]
        [Description("BarLabelFontColor")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarLabelFontColor", "进度条标签字体颜色")]
        public BrushEx BarLabelFontColor
        {
            get
            {
                return barLabelFontColor;
            }

            set
            {
                barLabelFontColor = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条标签字体")]
        [Description("BarLabelFontFamily")]
        [Editor(typeof(UI.XProperty.Editors.XFontFamilyEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarLabelFontFamily", "进度条标签字体")]
        public FontFamily BarLabelFontFamily
        {
            get
            {
                return barLabelFontFamily;
            }

            set
            {
                barLabelFontFamily = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条标签字体粗细")]
        [Description("BarLabelFontWeight")]
        [Editor(typeof(UI.XProperty.Editors.XFontWeightEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarLabelFontWeight", "进度条标签字体粗细")]
        public FontWeight BarLabelFontWeight
        {
            get
            {
                return barLabelFontWeight;
            }

            set
            {
                barLabelFontWeight = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条位置")]
        [Description("BarPlacement")]
        [Editor(typeof(UI.DataPartLib.XProperty.Editors.XPlacementTypesEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarPlacement", "进度条位置")]
        public PlacementTypes BarPlacement
        {
            get
            {
                return barPlacement;
            }

            set
            {
                barPlacement = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条是否显示阴影")]
        [Description("BarShadowEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarShadowEnabled", "进度条是否显示阴影")]
        public bool BarShadowEnabled
        {
            get
            {
                return barShadowEnabled;
            }

            set
            {
                barShadowEnabled = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条提示")]
        [Description("BarToolTipText")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarToolTipText", "进度条提示")]
        public string BarToolTipText
        {
            get
            {
                return barToolTipText;
            }

            set
            {
                barToolTipText = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条距离标尺距离(0-1)")]
        [Description("BarDistanceFromScale")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarDistanceFromScale", "进度条距离标尺距离(0-1)")]
        public double BarDistanceFromScale
        {
            get
            {
                return barDistanceFromScale;
            }

            set
            {
                barDistanceFromScale = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条开始宽度(0-1)")]
        [Description("BarStartWidth")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarStartWidth", "进度条开始宽度(0-1)")]
        public double? BarStartWidth
        {
            get
            {
                return barStartWidth;
            }

            set
            {
                barStartWidth = value;
                Refresh();
            }
        }

        [Category("进度条")]
        [DisplayName("进度条结束宽度(0-1)")]
        [Description("BarEndWidth")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "BarEndWidth", "进度条结束宽度(0-1)")]
        public double? BarEndWidth
        {
            get
            {
                return barEndWidth;
            }

            set
            {
                barEndWidth = value;
                Refresh();
            }
        }
    }
}
